﻿@using Super.Mvc
@using Zen.Barcode
@model Super.Entities.DiyOrder
@{
    ViewBag.Title = "产品编辑";
    var DiyComp = (List<DiyComponentsList>)ViewBag.DiyComp;
}
@using (Html.AjaxBeginForm("edit", "diy"))
{
    <div class="pageFormContent" layouth="56">
        @Html.HiddenFor(a => a.ID)
        <p><label>配置单类型:</label>
            @Html.DropDownList("DiyOrderType")
        </p>
        <div class="divider">
        </div>
        @Html.DWZTextBoxFor(a => a.OrderNo, "配置单编号").Disable()
        @Html.DWZTextBoxFor(a => a.Name, "配置单名称").Disable()
        @Html.DWZTextBoxFor(a => a.Price, "金额").Disable()
        @Html.DWZTextBoxFor(a => a.PayMoney, "支付金额").Disable()
        @Html.DWZTextBoxFor(a => a.PayTime, "支付时间").Disable()
        @Html.DWZTextBoxFor(a => a.User.Name, "用户").Disable()
        @Html.DWZTextAreaFor(a => a.Remark, "备注").Disable()
        <div class="divider">
        </div>
        <span style="color: green; font-size: 16px; font-weight: bold;">购买时间：@Model.PayTime</span> 
         <div class="divider"></div>
        <span style="color: red; font-weight: bold; font-size: 18px;">配件列表：</span>
        <div class="divider">
        </div>
        @{
    foreach (var item in DiyComp)
    {
            <p><label>@item.Product.ProductCategory.Name :</label> <input type="text" value="@item.Product.Title" style=" width: 270px" /> </p>
            <p style="width: 520px;"><label>保修时间：</label> <input type="text" value="@(item.Warrant)" name="bx@(item.ID)"/> <span>【单位：月】</span>
                @{
        if (Model.PayTime.HasValue)
        {

            if (Model.PayTime.Value.AddMonths(item.Warrant) > DateTime.Now)
            {
                    <span>剩余保修时间：</span>
                TimeSpan _Span = Model.PayTime.Value.AddMonths(item.Warrant) - DateTime.Now;
                    <span style="color: green">@((_Span.Days / 30).ToString() + "月")</span>
            }
            else
            {
                    <span style="color: red">已过保修期</span>
  
            }


        }
            
              
                }
            </p>
            <div class="divider">
            </div>
  
    }
  
        }
        @Html.TextBoxFor(a => a.CreateTime, new { type = "hidden" })
    </div>
    @Html.DWZFormBar()
}
<style type="text/css">
    .pageFormContent p { width: 480px; }
    .gridScroller { height: 200px; }
</style>
